package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MesMatplanMapper;
import com.ruoyi.system.domain.MesMatplan;
import com.ruoyi.system.service.IMesMatplanService;

/**
 * 物料计划原料Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-06-01
 */
@Service
public class MesMatplanServiceImpl implements IMesMatplanService 
{
    @Autowired
    private MesMatplanMapper mesMatplanMapper;

    /**
     * 查询物料计划原料
     * 
     * @param id 物料计划原料主键
     * @return 物料计划原料
     */
    @Override
    public MesMatplan selectMesMatplanById(Integer id)
    {
        return mesMatplanMapper.selectMesMatplanById(id);
    }

    /**
     * 查询物料计划原料列表
     * 
     * @param mesMatplan 物料计划原料
     * @return 物料计划原料
     */
    @Override
    public List<MesMatplan> selectMesMatplanList(MesMatplan mesMatplan)
    {
        return mesMatplanMapper.selectMesMatplanList(mesMatplan);
    }

    /**
     * 新增物料计划原料
     * 
     * @param mesMatplan 物料计划原料
     * @return 结果
     */
    @Override
    public int insertMesMatplan(MesMatplan mesMatplan)
    {
        return mesMatplanMapper.insertMesMatplan(mesMatplan);
    }

    /**
     * 修改物料计划原料
     * 
     * @param mesMatplan 物料计划原料
     * @return 结果
     */
    @Override
    public int updateMesMatplan(MesMatplan mesMatplan)
    {
        return mesMatplanMapper.updateMesMatplan(mesMatplan);
    }

    /**
     * 批量删除物料计划原料
     * 
     * @param ids 需要删除的物料计划原料主键
     * @return 结果
     */
    @Override
    public int deleteMesMatplanByIds(Integer[] ids)
    {
        return mesMatplanMapper.deleteMesMatplanByIds(ids);
    }

    /**
     * 删除物料计划原料信息
     * 
     * @param id 物料计划原料主键
     * @return 结果
     */
    @Override
    public int deleteMesMatplanById(Integer id)
    {
        return mesMatplanMapper.deleteMesMatplanById(id);
    }

    @Override
    public boolean isMatplanIdUnique(String matplanId)
    {
        int count = mesMatplanMapper.countByMatplanId(matplanId);
        return count == 0;
    }
}
